package com.xucy.springboot.controller;

import org.springframework.web.bind.annotation.ControllerAdvice;
import org.springframework.web.bind.annotation.ResponseBody;

/**
 * @Author xucy
 * @Date 2019-12-12 11:26
 * @Description
 **/

@ControllerAdvice
public class ExceptionHandler {

    @org.springframework.web.bind.annotation.ExceptionHandler(value = Exception.class)
    @ResponseBody
    public String handler(Exception e){
        System.out.println("未知异常！原因是:"+e);
        return e.getMessage();
    }
}
